import { createStore } from 'vuex'

export default createStore({
  state: {
    user:null,
    MyShopping: [],
  },
  mutations: {
    updateUser(state, user) {
      state.user = user;
      localStorage.setItem("user",  JSON.stringify(user));
    },
    updateMyShopping(state, shopping) {
      state.Myshopping.push(shopping);
      sessionStorage.setItem("Myshopping", state.MyShopping);
    },
    updategetlocalUser(state){
      state.user=JSON.parse(localStorage.getItem("user"));
    }
  },
  getters: {
    getUser:(state)=> state.user,
    getMyShopping: (state) => state.MyShopping,
  },
  actions:{

  },
  modules: {
  }
})
